import q from "querystring";
import { RequestHandler } from "express";
const formParse: RequestHandler = (req, res, next) => {
    // 1、定义一个str字符串，专门用来存储客户端发送来的请求体数据
    let str = "";

    req.on("data", (data: Buffer) => {
        str += data;
    });
    // 监听req的end事件
    req.on("end", () => {
        req.body = q.parse(str);
        next();
    });
};
export default formParse;
